package com.hspedu.homework.homework04;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/24
 * @time 19:02
 */
public class Homework04 {
    public static void main(String[] args) {
        Manager jack = new Manager("jack", 50, 30, 1000);
        Worker lucy = new Worker("lucy", 40, 30);
        System.out.println(jack.getMonSal());
        System.out.println(lucy.getMonSal());
    }
}

class Employee {
    private String name;
    private double daySal;
    private int workDays;

    public Employee(String name, double daySal, int workDays) {
        this.name = name;
        this.daySal = daySal;
        this.workDays = workDays;
    }

    public double getMonSal() {
        return this.daySal * workDays;
    }
}

class Manager extends Employee {
    private double bonus;

    public Manager(String name, double daySal, int workDays, double bonus) {
        super(name, daySal, workDays);
        this.bonus = bonus;
    }

    @Override
    public double getMonSal() {
        return super.getMonSal() * 1.2 + bonus;
    }
}

class Worker extends Employee {
    public Worker(String name, double daySal, int workDays) {
        super(name, daySal, workDays);
    }

    @Override
    public double getMonSal() {
        return super.getMonSal() * 1.0;
    }
}
